﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using YWTSSys.BLL;

namespace YWTSSys.Web
{
    public class Global : System.Web.HttpApplication
    {
        protected static string SyncUClaimDemage = "SyncUClaimDemage";
        protected void Application_Start(object sender, EventArgs e)
        {
            Application[SyncUClaimDemage] = "";
            //Application["StartTime"] = "";
            //Application["runtime"] = "";
        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// 清除缓存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            if (Application[SyncUClaimDemage].ToString()!=DateTime.Today.ToShortDateString())
            {
                Application[SyncUClaimDemage] = DateTime.Today.ToShortDateString();
              //  SyncSAPController.SyncUClaimDemage();
               // SyncSAPController.SyncAgentList();
               // SyncSAPController.SyncOITMList();
               // SyncSAPController.SyncUpdateInWillDate();
                BaseController.DC.Clear();
            }
            //Application["StartTime"] = System.DateTime.Now;
        }

        protected void Application_EndRequest(Object sender, EventArgs e)
        {
           // System.DateTime startTime = (System.DateTime)Application["StartTime"];
           // System.DateTime endTime = System.DateTime.Now;
           // System.TimeSpan ts = endTime - startTime;
           //// Application["runtime"] = (Convert.ToDouble((ts.Milliseconds)) / 1000);
           // Application["runtime"] = ts.Milliseconds;

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }

        
            
    }
}